import { getHospitalDepartmentAPI, getHospitalDetailAPI } from "@/api/hospital";
import { HospitalDepartment, HospitalDetail } from "@/api/type/hospital";
import { defineStore } from "pinia";
import { ref } from "vue";

export const useDeatilStore=defineStore('detail',()=>{
  let detailList=ref<HospitalDetail>()
  let departmentList=ref<HospitalDepartment>([])
  const getDetail=async(hoscode:string)=>{
    const res=await  getHospitalDetailAPI(hoscode)
    detailList.value=res.data
  }
  const getDepartmentList=async(hoscode:string)=>{
    const res=await getHospitalDepartmentAPI(hoscode)
    departmentList.value=res.data
    
  }
  return {
    detailList,
    departmentList,
    getDepartmentList,
    getDetail
  }
})